package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppCzMoneyDao;
import com.vf.admin.client.dao.AppOrderDao;
import com.vf.admin.client.service.AppCzMoneyService;
import com.vf.admin.client.service.AppOrderService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppCzMoney;
import com.vf.admin.miaodong.entity.AppOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AppOrderServiceImpl implements AppOrderService {

    @Autowired
    private AppOrderDao appOrderDao;

    @Override
    public List<AppOrder> list(Map<String,Object> paraMap, SplitPageBean splitPage){
        return appOrderDao.list(paraMap,splitPage);
    }
    @Override
    public AppOrder get(Integer id){
        return appOrderDao.get(id);
    }
    @Override
    public void save(AppOrder haoYou){
        appOrderDao.save(haoYou);
    }

    /**
     * 根据自定义唯一订单号查询代付款的订单信息
     */
    @Override
    public AppOrder getByOrdernum(String ordernum,Integer type,Integer state) {
        return appOrderDao.getByOrdernum(ordernum,type,state);
    }

    /**
     * 更新订单状态为已支付
     * @param type
     */
    @Override
    public void updateStastusYzf(String ordernum,Integer type) {
        appOrderDao.updateStastusYzf(ordernum,type);
    }

    @Override
    public boolean isFirstRecharge(Integer userId) {
        AppOrder firstRecharge = appOrderDao.isFirstRecharge(userId);
        return firstRecharge != null;
    }

}
